package com.zsrt.day20170406.am;

import static org.junit.Assert.*;

import java.util.Scanner;

import org.junit.Test;

public class FunctionDemo03Test {
	
	public int add(int a,int b){
		int sum=a+b;
		System.out.println(sum);
		return sum;
		
	}
	
	@Test
	public void addTest() throws Exception {
		int sum=add(10,20);		
	}
	
	public void number(){
		System.out.println("请输入一个五位的正整数：");
		Scanner in=new Scanner(System.in);
		int num=in.nextInt();
		int num1=num;
		in.close();
		int i=10,result=0;
		int ge,shi,bai,qian,wan;
		if(num>0&&num<100000){
			//System.out.println("输入正确");
			//123
			while(num1>0){
				num1/=i;
				result++;
			}
			System.out.println("这是一个"+result+"位的正整数");
			System.out.println("从低位到高位的数分别为：");
			
			for(int j=1;j<=result;j++){
				int k=num/((int)Math.pow(10,j-1))%10;
				System.out.print(k+"\t");
			}
			System.out.println();
			System.out.println("逆序输出为：");
			for(int j=1;j<=result;j++){
				int k=num/((int)Math.pow(10,j-1))%10;
				System.out.print(k);
			}
		}else{
			System.out.println("输入错误");
		}
	}
	
	@Test
	public void testNumber() throws Exception {
		number();
	}

}

